<script type="text/javascript">
	$(document).ready(function() {
		$("#searchresult").tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $(".pager")
		});
	});
</script>

<div id="main-content" class="prepend-1 span-19 last">
	<h3>Daftar Mahasiswa</h3>
<?php echo form_open($role.'/student/search/index', array('method' => 'get', 'class' => 'form')); ?>
	<h4>Form Pencarian Mahasiswa</h4>
	<table>
		<tr>
			<td width="200">Nama Mahasiswa</td>
			<td><input type="text" name="name" maxlength="64" style="width: 400px!important" value="<?php echo ext_set_value('name'); ?>" /></td>
		</tr>
		<tr>
			<td>Angkatan</td>
			<td>
				<select name="year">
					<option value="" <?php echo ext_set_select('year', '', TRUE); ?>>--Silakan pilih tahun--</option>
<?php 
	foreach ($years as $year) {
		echo '<option value="'.$year->year.'" '.ext_set_select('year', $year->year).'>'.$year->year.'</option>';
	}
?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Program Studi</td>
			<td>
				<select name="major">
					<option value="" <?php echo ext_set_select('major', '', TRUE); ?>>--Silakan pilih program studi--</option>
<?php 
	foreach ($majors as $major) {
		echo '<option value="'.$major->id.'" '.ext_set_select('major', $major->id).'>'.$major->major.'</option>';
	}
?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Beasiswa</td>
			<td>
				<select name="scholarship">
					<option value="" <?php echo ext_set_select('scholarship', '', TRUE); ?>>--Silakan pilih beasiswa--</option>
<?php 
	if ($scholarships != NULL) {
		foreach ($scholarships as $scholarship) {
			echo '<option value="'.$scholarship->id.'" '.ext_set_select('scholarship', $scholarship->id).'>'.$scholarship->name.'</option>';
		}	
	}
?>
				</select>
		</tr>
	</table>
	<input type="submit" name="search" value="Cari" class="submit" />
<?php echo form_close(); ?>
	<div class="clear"><?php echo nbs(); ?></div>
	<h4><?php echo $title; ?></h4>
	<table id="searchresult">
	<thead>
		<tr>
			<th>Nama Mahasiswa</th>
			<th width="150">Angkatan</th>
			<th width="300">Program Studi</th>
			<th>Beasiswa</th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager; ?>
	</tfoot>
	<tbody>
<?php
	if ($students == NULL) :
?>
		<tr>
			<td colspan="4" align="center"><span class="info">Tidak ditemukan mahasiswa yang sesuai dengan kriteria pencarian.</span></td>
		</tr>
<?php 
	else :
		foreach ($students as $student) :
?>
		<tr>
			<td><?php echo anchor($role.'/student/profile/index?id='.$student->id, $student->name); ?></td>
			<td align="center"><?php echo $student->year; ?></td>
			<td><?php echo $student->major; ?></td>
			<td><?php echo $student->scholarships; ?></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table><br />
	<div class="clear"><?php echo nbs(); ?></div>
</div>
